<?php $this->_extends('../_layouts/default_layout'); ?>
<?php $this->_block('contents'); ?>
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.mselect.old.js"></script>
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.tablesorter.js"></script>
<script type="text/javascript">
$(function(){
	$(".datepicker").datepicker({dateFormat:'yy-mm-dd',changeMonth:true});
	var shop_categories_data = <?=$shop_categories?>;
	var selected = [<?=isset($_GET['shop_id']) ? $_GET['shop_id'] : ''?>, <?=isset($_GET['shop_cat_1']) ? $_GET['shop_cat_1'] : ''?>, <?=isset($_GET['shop_cat_2']) ? $_GET['shop_cat_2'] : ''?>, <?=isset($_GET['shop_cat_3']) ? $_GET['shop_cat_3'] : ''?>];
	$(document).mselect(shop_categories_data, ['shop_id','shop_cat_1','shop_cat_2','shop_cat_3'], ['','','',''], selected);
	$(".list_table").tablesorter();
});
</script>
<fieldset><legend>查询条件</legend>
<form method="get">
<? include(Q::ini('custom_system/elements_dir') . 'searchform_element.php');?>
<table class="form_table">
	<tr>
		<th>日期</th>
		<td>
			<input type="text" class="datepicker" name="begin_time" value="<?=isset($_GET['begin_time']) ? $_GET['begin_time'] : ''?>" /> to 
			<input type="text" class="datepicker" name="end_time" value="<?=isset($_GET['end_time']) ? $_GET['end_time'] : ''?>" />
		</td>
	</tr>
	<tr>
		<th>网站分类</th>
		<td>
			<select id="shop_id" name="shop_id"></select>
			<select id="shop_cat_1" name="shop_cat_1"></select>
			<select id="shop_cat_2" name="shop_cat_2"></select>
			<select id="shop_cat_3" name="shop_cat_3"></select>
		</td>
	</tr>
	<tr>
		<th><input type="hidden" name="is_search" value="1" /></th>
		<td><input type="submit" class="button" value="查询" /></td>
	</tr>
</table>
</form>
</fieldset>
<?if (isset($result)):?>
<table class="list_table">
<thead>
	<tr>
		<th>名称</th>
		<th>销售数据</th>
	</tr>
</thead>
<tbody>
	<?foreach ($result as $r):?>
	<tr>
		<td align="left"><?=$r['name']?></td>
		<td><?=$r['value']?></td>
	</tr>
	<?endforeach;?>
</tbody>
</table>
<?endif;?>
<?php $this->_endblock(); ?>